package com.example.demo.pattern.strategy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: demo
 * @description: 测试类
 * @author: yby
 * @create: 2020-06-12 17:26
 **/
@RestController
@RequestMapping("/strategy")
public class TestController11 {

    @Autowired
    private StrategyContext strategyContext;

    @RequestMapping("/test")
    public void test() {
        strategyContext.getResource("ffff");
    }


    public static void main(String[] args) {
        System.out.println(formatDuration(10728566));
    }

    private static String formatDuration(long duration){
        if(duration <= 0)
            return "未知";
        long hour;
        long minute;
        long second;
        second=duration%1000==0?duration/1000:duration/1000+1;
        minute=second/60;
        hour=second/3600;
        String s=(second%60)<10?"0"+(second%60):(second%60)+"";
        String m=(minute%60)<10?"0"+(minute%60):(minute%60)+"";
        String h=hour<10?"0"+hour:hour+"";
        return h+":"+m+":"+s;
    }
}
